package com.heima.model.behavior.pojos;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.heima.model.annotation.IdEncrypt;
import lombok.Data;
import org.apache.ibatis.type.Alias;

import java.util.Date;

/**
 * APP不喜欢行为表
 */
@Data
@TableName(value = "ap_unlikes_behavior")
public class ApUnlikesBehavior {
    @TableId(value = "id", type = IdType.INPUT)
    private Long id;

    /**
     * 实体ID
     */
    @IdEncrypt
    @TableField(value = "entry_id")
    private Integer entryId;

    /**
     * 文章ID
     */
    @IdEncrypt
    @TableField(value = "article_id")
    private Integer articleId;

    /**
     * 0 不喜欢
     * 1 取消不喜欢
     */
    @TableField(value = "type")
    private Short type;

    /**
     * 登录时间
     */
    @TableField(value = "created_time")
    private Date createdTime;

    // 定义不喜欢操作的类型
    @Alias("ApUnlikesBehaviorEnumType")
    public enum Type{
        UNLIKE((short)0),CANCEL((short)1);
        short code;
        Type(short code){
            this.code = code;
        }
        public short getCode(){
            return this.code;
        }
    }
}
